import React, { Component } from "react";
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import routes from "./router/router";

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  render() {
    return (
      <Router>
        {routes.map((route, key) => {
          console.log(route);
          if (route.exact) {
            return (
              <Route
                key={key}
                exact
                path={route.path}
                render={(props) => <route.component {...props} />}
              />
            );
          } else {
            return (
              <Route
                key={key}
                path={route.path}
                render={(props) => <route.component {...props} />}
              />
            );
          }
        })}
      </Router>
    );
  }
}
export default App;
